<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>{$person}</title>
    {include file="inset/head/head_css.tpl"}
    {include file="inset/head/head_js.tpl"}
</head>
<body>
    	
   <div class="b-popup none">
      
    <div class="b-popup-content" >
	<div class="b-popup-header" align="right"><img id="close_popap" src="/static/img/toolbar/close-tab.png" width="20px"/></div>
        
        {*=====================Попап для создания клиента=====================*} 
        <form id="client_form" class="none">
            <div class="new_client">
                <div><label>Фамилия:</label></div>	
                <div><input type="text" class="validate[required,custom[onlyLetterSp],minSize[3],maxSize[100]]" id="name" name="name"/></div>		
            </div>
            <div class="new_client">
                <div><label>Имя:</label></div>	
                <div><input type="text" id="first_name"  class="validate[required,custom[onlyLetterSp],minSize[3],maxSize[100]]" name="first_name"/></div>		
            </div>
            <div class="new_client">
                <div><label>Отчество:</label></div>	
                <div><input type="text" id="second_name" class="validate[custom[onlyLetterSp],minSize[3],maxSize[100]]"  name="second_name"/></div>		
            </div>
            <div class="new_client">
                <div><label>Телефон:</label></div>	
                <div><input type="text" id="phone" class="validate[required,custom[phone]]" name="phone"/></div>
            </div>
            <p id="error_ph"></p>
            <div class="new_client">
                <div><label>email:</label></div>	
                <div><input type="text" id="email" class="validate[custom[email]]"  name="email"/></div>		
            </div>
            <div class="new_client">
                <div><label>Область:</label></div>	
                <div>
                    <select class="validate[required]" id="region">
                        <option></option>
                        {for  $i=0 to $region|@count-1}
                            <option value="{$region.$i.region_id}">{$region.$i.region}</option>
                        {/for}
                    </select>
                </div>		
            </div>
            <div class="new_client">
                <div><label>Город:</label></div>	
                <div>
                    <select class="validate[required]" id="city">
                        <option value=""></option>
                    </select>
                </div>		
            </div>
            <div class="new_client">
                <div><label>Улица:</label></div>	
                <div><input type="text" id="street" class="validate[required]"   name="street"/></div>		
            </div>

            <div class="new_client">
                <div><label>Дом:</label></div>	
                <div><input type="text" id="house"  name="house"/></div>		
            </div>
            <div class="new_client">
                <div><label>Подъезд:</label></div>	
                <div><input type="text" id="porch"  name="porch"/></div>		
            </div>
            <div class="new_client">
                <div><label>Квартира:</label></div>	
                <div><input type="text" id="houseroom" class="flat"  name="houseroom"/></div>		
            </div>
            <div class="new_client">
                <div><label>Сайт:</label></div>	
                <div>
                    <select id="id_site">
                        <option></option>
                        {for $i=0 to $site|@count-1}
                        <option value="{$site.$i.id}">{$site.$i.name}</option>
                        {/for}
                    </select>
                </div>		
            </div>
            <div class="client_submit">
               <input id="client_submit"  type="button" value="Сохранить"/>
            </div>
        </form>
    
        {*======================Попап для создания заказа=====================*}
        <form id="order_form" class="none">
	    <div class="new_order">
		<div><label>Код клиента:</label></div>	
		<div style=" text-align:left;margin-left:24px;">
                    <input type="text" class="validate[required,custom[integer]]" id="id_client" readonly name="id_client" style="width:30%;"/>
                </div>		
	    </div>
	    <div class="new_order">
		<div><label>Категория:</label></div>	
		<div>
		    <select class="validate[required]" width="90%" id="id_category">
			{for $i=0 to $params|@count-1}
			    <option value="{$params.$i.id}">{$params.$i.name}</option>
			{/for}
		    </select>
		</div>		
	    </div>
	    <div class="new_order">
		<div><label>Производитель:</label></div>	
		<div>
		    <select class="validate[required]" id="id_fabricator">
			{for $i=0 to $fabricator|@count-1}
			    <option value="{$fabricator.$i.id}">{$fabricator.$i.name}</option>
			{/for}
		    </select>
		</div>		
	    </div>
	    <div class="new_order">
		<div><label>Продукт:</label></div>	
		<div>
		    <select  class="validate[required]" id="product">
			<option>Выберете продукт</option>
    
		    </select>
		</div>		
	    </div>
	    <div class="new_order">
		<div><label>Количество</label></div>	
		<div><input class="validate[required,custom[integer]]" type="text" id="count" name="count"/></div>		
	    </div>
	     <div class="new_order">
		<div><label>Дата отправки:</label></div>	
		<div><input type="text" class="" value="" readonly id="date_ship" name="date_ship"/></div>
	    </div>
	    <div class="new_order">
		<div><label>Скидка:</label></div>	
		<div><input type="text" class="validate[required,custom[number]]" value="00.00" id="discont" name="discont"/></div>
	    </div>
	    <div class="new_order">
		<div><label>Сайт:</label></div>	
		<div>
		    <select id="id_site">
			<option value="1">mebelend.com.ua</option>
			<option value="2">mebelex.dp.ua</option>
			<option value="3">matras-sale.com.ua</option>
			<option value="4">artemdorofeyev</option>
		    </select>
		</div>		
	    </div>
	    <div class="client_submit">
            <input id="order_add"  type="button" value="Добавить ещё"/>
	    <input id="order_submit"  type="button" value="Сохранить"/>
	    </div>
	</form>
    </div>      
   </div>	
                    
    <div class="wrapper">
        {include file="inset/header.tpl"}
        
        {include file="inset/menu/vermenu.tpl"}
	
        <div class="content">
	    <div class="navigation">
		<div class="client_navigation">
		<form action="/client/find/" method="get" id="client_form">
		   <ul>
		    <li>
			<div id="client_button" class="button">
			    Создать клиента	
			</div>
		    </li>
                    <li>
			<div id="client_order_button" class="button novisibolity">
			    Создать заказ	
			</div>
		    </li>
		    <li>
			<label>ФИО</label>
			<input name="name"  type="text" />
		    </li>
		    <li>
			<label>Телефон</label>
			<input name="phone" type="text" />
		    </li>
		    <li>
			<label>Сайт</label>
			<select name="id_site">
			    <option value="">Все</option>
                            {for $i=0 to $site|@count-1}
                               <option value="{$site.$i.id}">{$site.$i.name}</option>
                            {/for}
			</select>
		    </li>
		    <li><input type="submit" value="найти"/></li>
		   </ul>
		</form>
		</div><!--client_navigation-->
	    </div><!--navigation-->
	    <table id="client_table" class="client_table" cellspacing="0" cellpadding="0">
	        <tr>
                    <th width="8%">
		        Код клиента
                    </th>
	            <th width="17%">
		        Фамилия
                    </th>
		    <th width="15%">
		        Телефон
		    </th>
		    <th width="16%">
		        Область
		    </th>
		    <th width="17%">
		        Город
		    </th>
		    <th width="5%">
		        Удалить
		    </th>
		    <th width="20%">
		        Создатель
		    </th>
	        </tr>
                {if isset($client)}
                {for $i=0 to $client|@count-1}
		<tr>
                    <td>
                        <p>{$client.$i.id}</p>
                    </td>
		    <td>
			<p><a href="/someclient/index/{$client.$i.id}">{$client.$i.name} {$client.$i.first_name} {$client.$i.second_name}</a></p>
		    </td>
		    <td>
			<p>{$client.$i.phone} </p>
		    </td>
		    <td>
			<p>{$client.$i.region} </p>
		    </td>
		    <td>
			<p>{$client.$i.city}</p>
		    </td>
		    <td>
			<p><a onclick='if (confirm("Удалить?")) {  window.location ="/client/delete/{$client.$i.id}";}' href="#">X</a></p>
		    </td>
		    <td>
			<p>{$client.$i.id_person}</p>
		    </td>
		</tr>
		{/for}
                <tr>
                    <td colspan="7" class="pages"><div> <p>{$pages}</p></div></td>
                </tr>
                {/if}
                {if isset($error)}
                <tr>
                    <td colspan="6">{$error.error}</td>
                </tr>
                {/if}
	    </table>
           
	</div>
    </div>
    {include file="inset/footer.tpl"}
</body>
</html>
